﻿using TianYuan.Core.Dependency;
using TianYuan.Core.Domain.Entities;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;

namespace TianYuan.Data.Dapper.Repositories
{
    /// <summary>
    /// 主键为string的泛型仓储接口
    /// </summary>
    /// <typeparam name="TEntity"></typeparam>
    public interface IRepository<TEntity> : IRepository<TEntity, string> where TEntity : class, IEntity<string>, new()
    {

    }
    /// <summary>
    /// 基础泛型仓储接口
    /// </summary>
    /// <typeparam name="TEntity"></typeparam>
    /// <typeparam name="TKey"></typeparam>
    public interface IRepository<TEntity, in TKey> : ITransientDependency, ISimpleClient<TEntity> where TEntity : class, IEntity<TKey>, new()
    {
        /// <summary>
        /// 获取当前的数据操作端
        /// </summary>
        /// <returns></returns>
        IDbContext ContextInstance();
        
        
        /// <summary>
        /// 根据字段名获取集合
        /// </summary>
        /// <param name="filed"></param>
        /// <param name="value"></param>
        /// <returns></returns>
        IEnumerable<TEntity> GetByFiledName(string filed, string value);
    }
}